package com.example.activitylifecycle;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;
import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;

public class NewActivity extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_new);
        Button bt1 = (Button)findViewById(R.id.button2);
        Toast.makeText(this,this.getIntent().getExtras().getString("k"),Toast.LENGTH_LONG).show();
        bt1.setOnClickListener((v)->{
            Intent intent = new Intent();
            Bundle bd=new Bundle();
            bd.putString("r","result");
            setResult(RESULT_OK,intent);
            this.finish();
        });
    }
}
